import { defineStore } from 'pinia'

interface UserState {
  username: string
  role: string
  token: string | null
}

export const useUserStore = defineStore('user', {
  state: (): UserState => ({
    username: '管理员',
    role: 'admin',
    token: null
  }),
  
  actions: {
    logout() {
      this.token = null
      // 可以添加登出逻辑
    },
    
    updateUserInfo(userInfo: Partial<UserState>) {
      Object.assign(this, userInfo)
    }
  }
}) 